package com.daihou.BCJ.others;

import com.daihou.model.ceres.In_Others;
import com.daihou.utils.ConfigOthers;
import com.daihou.utils.DHHttpUtil;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class otYuqizonge {
	private String url;
	Map<String, String> headers;
	@BeforeTest(description = "测试准备工作,获取Authorization对象")
	public void beforeTest() throws IOException {
		//url= ConfigOthers.getUrl(In_Others.YUQIZONGE.toString());
		//这里是访问 账务地址
		//url="http://core-proxy-web-onlyquery-test_env_121.test.weicai.com.cn/account/ermas/overdueAmt";
		//core-proxy-web-onlyquery-test_env_121 对应ip 172.16.1.128:4155 如果重新部署了，需要修改ip地址
		url="http://172.16.1.128:4155/account/ermas/overdueAmt";
		headers=new HashMap<>();
	}

	@Test(description = "逾期总额查询")
	public void s1() throws IOException {
		String strBody = "{\"mode\":\"BILL\",\"callSource\":\"DAIHOU\",\"contractNo\":\"3_20081717205AAB8366004C80AC72B12227C6D224\"}";
		String result = DHHttpUtil.post_with_String(url,strBody,headers).toJSONString();
		System.out.println("================ "+result);
		//后端返回000000状态码 与前端不一样
		Assert.assertTrue(result.contains("\"message\":\"操作成功\",\"status\":\"000000\""));
	}
}